﻿TomatoBreak = @TomatoBreak
$ = jQuery

createController = TomatoBreak.ControllerFactory.create
changePage = TomatoBreak.changePage

class HomeController extends Spine.Controller

    @elements:
        '#home':    'home'
        '#sign-up': 'signUp'
        '#sign-in': 'signIn'

    constructor: ->

        super

        createController @signUp, TomatoBreak.MembershipController, modelName: 'User'
        createController @signIn, TomatoBreak.MembershipController, modelName: 'Session'

        @routes
            '!/sign-up': => changePage @signUp
            '!/sign-in': => changePage @signIn
            ''         : => changePage @home

        Spine.Route.setup()

$ -> new HomeController el: $ '#main'